/*
 * This file is part of JContextFree.
 *
 * JContextFree is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JContextFree is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JContextFree.  If not, see <http://www.gnu.org/licenses/>.
 */

package it.enricod.jcontextfree.engine.model.impl;

import it.enricod.jcontextfree.engine.model.FigureRegion;
import it.enricod.jcontextfree.engine.model.IFigureParameters;
import it.enricod.jcontextfree.engine.model.IFigureRegionCalculator;
import it.enricod.jcontextfree.engine.model.vo.Position2D;

/**
 * spazio occupato da un cerchio
 * @author enrico
 *
 */
public class CircleRegionCalculator implements IFigureRegionCalculator {


	public FigureRegion calculateRegion(IFigureParameters parameters) {
		double hs = parameters.getAbsolute().getScale() / 2;
		
		double x1 = parameters.getAbsolute().getX() - hs;
		double x2 = parameters.getAbsolute().getX() + hs;
		double y1 = parameters.getAbsolute().getY() - hs;
		double y2 = parameters.getAbsolute().getY() + hs;

		return new FigureRegion( Position2D.createInstance(x1,y1), Position2D.createInstance(x2,y2));
	}

	
}
